<template>
  <div style="height: 100%;">
    <message-list :messages="messageList"/>
  </div>
</template>

<script>
import messageList from '@/components/messageList'
import api from '@/api'
export default {
  name: 'ordinary-message',
  data () {
    return {
      messageList: []
    }
  },
  methods: {
    // teacherMessagManagement
    select () {
      let params = {
        id: JSON.parse(sessionStorage.getItem('user')).id,
        // id: JSON.parse(sessionStorage.getItem('user')).id
        type: this.$route.params.type
      }
      api.teacherMessagManagement({
        params,
        callback: res => {
          this.messageList = res.data.data
        }
      })
    }
  },
  components: {
    messageList
  },
  created () {
    this.select()
    // let key = 'list' + this.$route.params.type
    // if (this[key]) {
    //   this.messageList = this[key]
    // }
  }
}
</script>

<style scoped>

</style>
